<!DOCTYPE html>
<html lang="en">
<#include "../common/head.html"/>
<body>
<#include "../common/header.html"/>
<div class="con">
  <div class="col-md-12">
    <#if errorMessage??>
      <div class="alert alert-info alert-dismissible fade in" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
        </button>
        ${errorMessage!}
      </div>
    </#if>
    <h3>我的审批</h3>
    <table class="table table-bordered " style="background-color: white;">
      <thead>
      <tr>
        <th>预约用户</th>
        <th>教学楼</th>
        <th>楼层</th>
        <th>教室</th>
        <th>教室类型</th>
        <th>时间</th>
        <th>预约时间课节</th>
        <th>辅导员</th>
        <th>楼主</th>
        <th>一级评审意见</th>
        <th>二级评审意见</th>
        <th>预约状态</th>
        <th>操作</th>
      </tr>
      </thead>
      <tbody>
      <#if ordersList?size gt 0>
        <#list ordersList as item>
          <tr>
            <td>${item.userName!}</td>
            <td>${item.floorName!}</td>
            <td>${item.floor!}</td>
            <td>${item.roomName!}</td>
            <td>${item.scale!}</td>
            <td>${item.orderTime!}</td>
            <td>${item.week?switch("1","上午第一大节","2","上午第二大节","3","下午第一大节","4","下午第四大节","5","晚上第一大节","6","晚上第二大节")}</td>
            <td>${item.opinionUser1!}</td>
            <td>${item.opinionUser2!}</td>
            <td>${item.opinion1!}</td>
            <td>${item.opinion2!}</td>
            <td>${item.status?switch("WAIT","待审批","AGREE_1","一级评审同意","REJECT_1","一级评审拒绝","AGREE_2","二级评审同意","OVER_TIME","超时","二级评审拒绝")}</td>
            <td>
              <#if sessionUser.type == "LANDLORD" && item.status == "AGREE_1">
                <a class="btn btn-default btn-xs" onclick="sp('${item.id}')">审批</a>
              </#if>
              <#if sessionUser.type == "COUNSELOR" && item.status == "WAIT">
                <a class="btn btn-default btn-xs" onclick="sp('${item.id}')">审批</a>
              </#if>
            </td>
          </tr>
        </#list>
      <#else>
        <tr>
          <td colspan="15">找不到符合条件的数据</td>
        </tr>
      </#if>
      </tbody>
    </table>
  </div>

</div>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                  aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">预约审批</h4>
      </div>
      <form action="/orders/sp" class="form-horizontal" method="post">
        <input type="hidden" name="id" id="id">
        <div class="modal-body">
          <div class="form-group">
            <label class="col-sm-3 control-label">审批结果</label>
            <div class="col-sm-8">
              <label class="radio-inline"><input type="radio" name="result" value="1">同意</label>
              <label class="radio-inline"><input type="radio" name="result" value="0">拒绝</label>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">审批意见</label>
            <div class="col-sm-8">
              <textarea name="remark" class="form-control"></textarea>
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
          <button type="submit" class="btn btn-primary">提交</button>
        </div>
      </form>
    </div>
  </div>
</div>
<#include "../common/footer.html"/>
<script>
    function sp(id) {
        $("#id").val(id);
        $("#myModal").modal("show");
    }

</script>
</body>
</html>